package com.slz3.business.module.drawManagement.draFreeLottery.steward;

import com.slz3.business.frame.redis.Jedis;
import com.slz3.business.frame.redis.RK;
import com.slz3.business.module.memberManagement.memMember.domain.MemMember;

import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * @author fengshiyou  on 2018/12/15 8:13 PM
 * 免费活动Redis操作工具类
 */
public class FreeDrawRedisUtil {

    /**
     * 根据活动ID获得参与用户信息
     * @param drawId 活动id
     * @return List
     */
    public static List<Map<String,String>> getPartInPersons(Long drawId) {
        String userPartKey =generateUserRedisKey(drawId);
        return Jedis.db0.getListStartEnd(userPartKey, 0, -1);
    }

    /**
     * 生成免费活动Redis key
     * @param uuid 活动UUID
     * @return string
     */
    private static String generateUserRedisKey(Long uuid) {
        return String.format("%s:%s:%s:%s:%s:%s:%s", RK.BUSSINES, RK.DRAW, RK.DRA_FREE_LOTTERY, RK.DRAW_ITEM, RK.PARTAKE, uuid, RK.DATA_MAP);
    }


}
